#! /bin/sh

cd ..

checkdep () {
    $1 --help 2>/dev/null >/dev/null
    [ $? -eq 127 ] && return 1 || return 0
}

findmake () {
    make=""
    checkdep make ; [ $? -eq 0 ] && make="make"
    checkdep gmake ; [ $? -eq 0 ] && make="gmake"
    echo $make
}

MAKE=`findmake`
[ "$MAKE" = "" ] && {
        echo "**************** ERROR ***********************"
        echo "make or gmake don't seem to be installed"
        echo "you need a make command into your PATH"
        echo "**********************************************"
        exit
}

$MAKE